Components Required
- Arduino Uno:
- 16x2 LCD Display:
- 2 x Toggle Switches
- 2 x 10K Resistors
- 10K Preset
About 16x2 LCD Display
The name "16x2 LCD display" comes from the fact that it has 16 columns and 2 rows, meaning we can display 32 characters on this screen. Characters can be alphabets, numbers, or custom-made characters. Each column is made from a 5x8 matrix of pixels (40 pixels per column).
- Operating voltage: 4.7V to 5.3V
- Current consumption: 1mA without backlight
- Alphanumeric display: can show alphabets and numbers
- Works in both 8-bit and 4-bit mode
- Available in Green and Blue backlight
Pinouts
- 1. Vss: Connect to GND
- 2. Vdd: +5V (4.7V–5.3V)
- 3. VEE: Contrast adjustment
- 4. RS: Command/data register
- 5. R/W: Normally GND (write mode)
- 6. Enable: Activates read/write
- 7-14. Data bits (D0–D7)
- 15. LED+: Backlight
- 16. LED-: Backlight
LCD Display Interfacing with Arduino
VSS and LED- are grounded. VCC and LED+ connect to Arduino’s 5V. A Preset is connected to VEE to adjust contrast. LCD pins are connected as follows:
- RS → Pin 6
- R/W → Pin 7
- E → Pin 8
- DB4 → Pin 9
- DB5 → Pin 10
- DB6 → Pin 11
- DB7 → Pin 12
Toggle switch connections:
- Switch 1: One terminal to 5V, other to A0. Resistor between A0 and GND.
- Switch 2: One terminal to 5V, other to A1. Resistor between A1 and GND.
Circuit Diagram

Arduino Code
#include <LiquidCrystal.h>
LiquidCrystal lcd(6, 7, 8, 9, 10, 11, 12);
unsigned long currentTime = 0, previousTime = 0;
int centiseconds = 0, seconds = 0, minuites = 0, hours = 0, button = A0;
void setup() {
pinMode(button, INPUT);
lcd.begin(16, 2);
}
void loop() {
if (digitalRead(button) == HIGH) {
lcd.setCursor(0, 0);
lcd.print("time stopped");
delay(1000);
while (digitalRead(button) == LOW);
delay(1000);
}
if (centiseconds == 0) {
lcd.clear();
}
currentTime = millis();
centiseconds = currentTime / 10;
seconds = currentTime / 1000;
minuites = seconds / 60;
hours = minuites / 24;
centiseconds = centiseconds - seconds * 100;
seconds = seconds - minuites * 60;
minuites = minuites - hours * 60;
lcd.setCursor(0, 0);
lcd.print("Time elasped");
lcd.setCursor(0, 1);
lcd.print(hours);
lcd.print(":");
lcd.print(minuites);
lcd.print(":");
lcd.print(seconds);
lcd.print(":");
lcd.print(centiseconds);
}